package Offer;
/*
*  调整数组顺序使奇数位于偶数前面
*       快速排序
*
* */
public class Offer21exchange {
    public int[] exchange(int[] nums) {
        if(nums.length==0 || nums==null){
            return new int[]{};
        }
        int right=nums.length-1;
        int left=0;
        while(left<right){
            while(left<right && nums[right]%2==0){
                right--;
            }
            while(left<right  && nums[left]%2==1){
                left++;
            }
            int tmp=nums[left];
            nums[left]=nums[right];
            nums[right]=tmp;
        }
        return nums;
    }
}
